package com.wing.enumeration;

public enum DispatchWorkStatusEnum {

    STAGING("STAGING", "暂存"),
    WAIT_AUDIT("WAIT_AUDIT", "待审核"),
    AUDIT_PASS("AUDIT_PASS", "已审核"),
    FINISH("FINISH", "已完成");

    private final String code;
    private final String description;

    // 构造函数
    DispatchWorkStatusEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    // Getter 方法
    public String getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    // 通过code查找AuditStatus的方法
    public static DispatchWorkStatusEnum getByCode(String code) {
        for (DispatchWorkStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("No matching audit status for code: " + code);
    }

    // 可选：如果需要根据code获取description，可以提供此方法
    public static String getDescriptionByCode(String code) {
        DispatchWorkStatusEnum status = getByCode(code);
        return status.getDescription();
    }

}
